/**
 * @format
 */

import AsyncStorage from '@react-native-community/async-storage';
import {AppRegistry, LogBox} from 'react-native';
import { XStorage, XWidget } from 'react-native-easy-app';
import App from './App';
import {name as appName} from './app.json';
import { RNStorage } from './src/common/Storage/AppStorage';
import HttpConfig from './src/Http/HttpConfig';
import XLog from './src/libs/XLog';
import DataCenter from './src/logic/DataCenter';

global.ErrorUtils.setGlobalHandler((error, isFatal)=>{
    XLog.e("unhandle exception:", error?.name, error?.message, error?.stack, isFatal);
});

async function main() {
    HttpConfig.init();
    XStorage.initStorage(RNStorage, AsyncStorage, ()=>{

    }, (data) => {

    });

    XWidget.initReferenceScreen(1280,800);
    DataCenter.initDataCenter();
    AppRegistry.registerComponent(appName, () => App);
    // AppRegistry.registerRunnable("test", ()=>{
    //     setInterval(()=>{
    //         console.log("runnable");
    //     }, 1000*10);
    // });
    // AppRegistry.getRunnable("test")["run"]();
}

main();